<?php
error_reporting(0);
$isadmin=1;
include 'check.php';
include_once '../comm/conn.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="5" leftmargin="0">
<table width="700" border="0">
<tr>
<td style="padding-left:10px; font-size:20px; color:#990000; font-weight:bold">多多返利系统7.4专用数据库检测修复工具(2012.06.07)</td>
</tr>
<tr>
  <td style="padding-left:20px;"><?php
include_once '../comm/conn.php';
$link = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_query("set names utf8");
mysql_select_db($dbname);
$i=0;$j=0;

echo '<span style="font-weight:bold; color:#ff6600; font-size:12px;">开始检测数据库基础表......</span><br>';
$rs=mysql_query("show tables like '".$BIAOTOU."ad';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."ad<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."article';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."article<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."category';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."category<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."file';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."file<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."mall';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."mall<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."mall_comment';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."mall_comment<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."mall_order';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."mall_order<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."malltype';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."malltype<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."mingxi';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."mingxi<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."msg';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."msg<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."msgset';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."msgset<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."shop';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."shop<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."slides';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."slides<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."taobaoset';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."taobaoset<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."tixian';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."tixian<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."tradelist';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."tradelist<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."user';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."user<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."websetting';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."websetting<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."yqlj';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."yqlj<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."apilogin';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."apilogin<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."apireg';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."apireg<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."activity';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."activity<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."dhdingdan';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."dhdingdan<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."dhlist';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."dhlist<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."nav';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."nav<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."tempdata';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."tempdata<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."catelist';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."catelist<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."city';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."city<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."setting';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."setting<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."tuan_goods';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."tuan_goods<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."role';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."role<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."access';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."access<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."menu';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."menu<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."adminlog';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."adminlog<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."service';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."service<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."seo';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."seo<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."seo';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."seo<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."shai';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."shai<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."shai_comment';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."shai_comment<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."shai_hart';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."shai_hart<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."noword';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."noword<br>";$i++;}

$rs=mysql_query("show tables like '".$BIAOTOU."shai_blacklist';");	
if(mysql_num_rows($rs)==0){echo "缺少表".$BIAOTOU."shai_blacklist<br>";$i++;}

if($i==0){echo " 数据表正常！";}

echo '<span style="font-weight:bold; color:#ff6600; font-size:12px;"><br>开始检测数据库基础表表内字段......</span><br>';
$rs=mysql_query("show fields from `".$BIAOTOU."ad`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","content","adtype","addtime");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."ad中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."article`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","cid","title","subtitle","att","pic","source","author","resume","pubdate","content","hits","created_by","created_date","delete_session_id","ontop","hot");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."article中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."category`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","pid","name","description","seq");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."category中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."duoduo2010`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","adminname","adminpass","lastlogintime","lastloginip","loginnum","logintime","loginip","role_id","regtime");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."duoduo2010中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."file`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","path","size","upload_date");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."file中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."mall`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","name","merchant","duomaiid","yiqifaid","url","logo","catid","fan","hdfk","zgfp","yfzc","ding","cai","des","js","time","sort","yilink","lm","renzheng","end_time","api_url","api_rule","api_city");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."mall中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."mall_comment`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","mall_name","mall_id","user_name","user_id","fen","comment","time");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."mall_comment中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."mall_order`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","order_time","merchant_id","u_id","ddusername","order_code","item_count","item_price","sales","commission","fxje","bill_yyyymmdd","stat_desc","prod_id","qrsj","product_code","unique_id","lm","adid");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."mall_order中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."malltype`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","typename","typecode","sort");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."ad中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."mingxi`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","ddusername","shijian","je","jifen","addtime","memo","leave_money");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."mingxi中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."msg`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","title","content","addtime","see","ddusername","senduser");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."msg中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."msgset`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","msg","type");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."msgset中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."shop`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","nick","uid","cid","consumer_protection","level","score","total_num","good_num","city","state","sid","title","pic_path","created","shop_click_url","type","addtime","hits","tuijian","item_score","service_score","delivery_score","fanxianlv","good");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."shop中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."slides`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","pic","url","title","hide","addtime","wz");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."slides中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."taobaoset`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","appKey","appSecret","appkey2","appsecret2","appkey3","appsecret3","appkey4","appsecret4","appkey5","appsecret5","userpid","usernick","seckey",'appnum','appnum2','appnum3','appnum4','appnum5',"sessionkey","sessiontime","getkey","chkey");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."taobaoset中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."tixian`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","ddusername","txje","zfb","addtime","addip","txstate","realname","mobile","why");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."tixian中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."tradelist`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","pay_time","item_title","shop_title","num_iid","seller_nick","pay_price","commission_rate","commission","item_num","trade_id","outer_code","qrsj","fxje","checked","ddjt","real_pay_fee");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."tradelist中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."user`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","ddusername","ddpassword","tbusername","regtime","loginnum","lastlogintime","lasttixian","zfb","email","money","txstate","dengji","tjr","mobile","qq","pass_question","pass_answer","yitixian","jifen","dhstate","fxb","jihuo","hart","regip");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."user中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."websetting`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","fxbl","fxbl2","fxbl3","fxbl4","mallfxbl1","mallfxbl2","mallfxbl3","mallfxbl4","tgbl","webtitle","webdesc","keyword","description","url","surl","email","icp","tongji","qq","webnick","emsg","gonggao","renzheng","tixianje","txxz","zhucesong","zhucesonglevel","liebiao","wjt","moresort","moban","hcopen","hctime","dengji1","dengji2","dengji3","shopcj","shopcj_s","shopcj_e","pagesize","smtp_host","smtp_user","smtp_pw","smtp_open","fxbname","hotword","webclose","webclosemsg","webtype","cha","apisize","mallzh","mallmm","mallwzbh","uc","apijk","gettime","miyue","jifen_open","jifenbl","zsjifen","fxb_open","spider","ban_spider_open","tao_pj_open","tgopen","yisid","yiwid","yiname","tgurl","serviceopen",'reg_send_email','tixian_send_email','sign_open','sign_money','sign_jifen','email_jihuo','reg_send_email','tixian_send_email','sign_open','sign_money','sign_jifen','urlkey','hytxjl','picwjt','duomaimiyue','duomaiid','duomaiwid','duomaiwbh','picjm','searchlimit','searchs8','reg_between');
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."websetting中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."yqlj`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("Id","url","webname","addtime","leibie","pic","wz");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."yqlj中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."apilogin`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("dduserid","ortheruserid","ortherusername","ortherwebname","time");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."apilogin中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."apireg`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","taoappKey","taoappSecret","qqappKey","qqappSecret","qqlappKey","qqlappSecret","sinaappKey","sinaappSecret","alipayappKey","alipayappSecret","taoappon","qqappon","qqlappon","sinaappon","alipayappon","kaixinappKey","kaixinappSecret","kaixinappon","apireg");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."apireg中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."activity`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","mallid","mallname","name","pic","stime","etime","url","des","content","sort","recommend","time");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."activity中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."dhdingdan`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","name","ddusername","dduserid","ip","spid","spend","tbusername","address","email","mobile","qq","remarks","addtime","shoptime","status","fangshi","return_msg");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."dhdingdan中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."dhlist`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","pic","jifen","money","name","hide","addtime","sort","content","num","recommend");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."dhlist中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."nav`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","name","link","sort","hide","auto","target","tag");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."nav中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."tempdata`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","commission","carry","userfunds","userno");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."tempdata中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."catelist`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","catename","sortorder","keywords");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."catelist中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."city`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("cityid","cityname","sortorder","pinyin","first_word","isshow");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."city中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."setting`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","var","val","constant");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."setting中缺少字段".$myfield."<br>";$j++;}
}
unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."tuan_goods`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","local","mall_id","city","catname","title","image","startTime","endTime","value","price","rebate","bought","addtime","editime","sort","salt","top","content");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."tuan_goods中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."role`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","name","status");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."role中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."access`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("role_id","menu_id","parentid");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."access中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."menu`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","parentid","status","name","url","listorder");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."menu中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."adminlog`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","admin_name","ip","act_name","time");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."adminlog中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."service`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","name","code","type");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."service中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."seo`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","tag","url","title","keyword","desc","label","del");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."seo中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."shai`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","ddusername","dduserid","tao_id","trade_id","image","title","price","fxje","catid","isfan","url","click_url","keywords","comment","xs","hart","hits","time","sort",'jifen');
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."shai中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."shai_comment`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","shai_id","xs","comment","time","dduserid","ddusername");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."shai_comment中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."shai_hart`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","shai_id","xs","dduserid","time");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."shai_hart中缺少字段".$myfield."<br>";$j++;}
}

unset($data);
$rs=mysql_query("show fields from `".$BIAOTOU."noword`;");
while($row=mysql_fetch_array($rs)){$data[]=$row['Field'];}
$myarr = array("id","word");
foreach($myarr as $myfield){
	if(!in_array($myfield,$data)){echo "表".$BIAOTOU."noword中缺少字段".$myfield."<br>";$j++;}
}


if($j==0){echo "数据表内字段正常！<br><br>";}

mysql_close($link);

if($j+$i!=0){
	echo "<br><input type=\"button\" name=\"Submit\" value=\" 一键修复 \" onclick=\"location.href='repairdb.php'\" />";
}
?></td>
</tr>
<tr>
<td style="padding-left:10px; color:#999999; line-height:25px;"><br><br>如果您的数据库缺少字段，可能是你的数据库被破坏或没有运行升级文件。<br>
1、如果你是升级后出现：说明你没有运行升级文件。<br>
2、如果是平时出现：可能数据库被破坏。<br>
3、如果是恢复数据后出现，可能你的数据库被还原到老版本了。<br>
4、如果无法确定提交论坛寻求帮助。
</td>
</tr>
</table>
</body>
</html>